package com.to8to.scene.client;

import java.util.Arrays;
import java.util.List;

import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TTransport;
import org.slf4j.MDC;

import com.to8to.kitt.client.ThriftClientFactory;
import com.to8to.thrift.diary.advanced.JudgeProductUsedRequest;
import com.to8to.thrift.diary.advanced.ListAllCategoryStatRequest;
import com.to8to.thrift.diary.advanced.ListAllCategoryStatResponse;
import com.to8to.thrift.diary.advanced.ListCompanyAllScenesRequest;
import com.to8to.thrift.diary.advanced.ListCompanyTopDiaryRequest;
import com.to8to.thrift.diary.advanced.ListJingXuanSceneRequest;
import com.to8to.thrift.diary.advanced.ListJingXuanSceneResponse;
import com.to8to.thrift.diary.advanced.ListNewestSceneRequest;
import com.to8to.thrift.diary.advanced.ListNewestSceneResponse;
import com.to8to.thrift.diary.advanced.ListProgressImagesRequest;
import com.to8to.thrift.diary.advanced.ListSceneCondition;
import com.to8to.thrift.diary.advanced.ListSceneDetailRequest;
import com.to8to.thrift.diary.advanced.ListSceneDetailResponse;
import com.to8to.thrift.diary.advanced.ListSceneDiaryViewsRequest;
import com.to8to.thrift.diary.advanced.ListStatisticRequest;
import com.to8to.thrift.diary.advanced.RecommendSceneRequest;
import com.to8to.thrift.diary.advanced.VerifyRequest;
import com.to8to.thrift.diary.behavior.BehaveRequest;
import com.to8to.thrift.diary.behavior.ListBehaviorRequest;
import com.to8to.thrift.diary.comment.CreateCommentRequest;
import com.to8to.thrift.diary.comment.DeleteCommentRequest;
import com.to8to.thrift.diary.comment.ListCommentsRequest;
import com.to8to.thrift.diary.consts.constConstants;
import com.to8to.thrift.diary.diary.CreateDiaryRequest;
import com.to8to.thrift.diary.diary.DeleteDiaryRequest;
import com.to8to.thrift.diary.diary.ListDiariesRequest;
import com.to8to.thrift.diary.diary.UpdateDiaryRequest;
import com.to8to.thrift.diary.message.ListMessagesRequest;
import com.to8to.thrift.diary.message.ListMessagesResponse;
import com.to8to.thrift.diary.message.UpdateMessageRequest;
import com.to8to.thrift.diary.message.UpdateMessageResponse;
import com.to8to.thrift.diary.module.TBehavior;
import com.to8to.thrift.diary.module.TComment;
import com.to8to.thrift.diary.module.TDiary;
import com.to8to.thrift.diary.module.TMessage;
import com.to8to.thrift.diary.module.TProduct;
import com.to8to.thrift.diary.module.TScene;
import com.to8to.thrift.diary.module.TSortField;
import com.to8to.thrift.diary.module.TStType;
import com.to8to.thrift.diary.module.TUserScore;
import com.to8to.thrift.diary.product.CreateProductRequest;
import com.to8to.thrift.diary.product.DeleteProductRequest;
import com.to8to.thrift.diary.product.ListProductRequest;
import com.to8to.thrift.diary.product.UpdateProductRequest;
import com.to8to.thrift.diary.scene.CreateSceneRequest;
import com.to8to.thrift.diary.scene.DeleteSceneRequest;
import com.to8to.thrift.diary.scene.ListCompaniesRequest;
import com.to8to.thrift.diary.scene.ListScenesRequest;
import com.to8to.thrift.diary.scene.UpdateSceneRequest;
import com.to8to.thrift.diary.service.SceneDiaryService;
import com.to8to.thrift.diary.service.SceneDiaryService.Iface;
import com.to8to.thrift.diary.stconfigs.GetAllStConfigIdMapRequest;
import com.to8to.thrift.diary.stconfigs.GetAllStConfigIdMapResponse;
import com.to8to.thrift.diary.stconfigs.GetStConfigSubIdMapRequest;
import com.to8to.thrift.diary.stconfigs.GetStOrderListRequest;
import com.to8to.thrift.diary.user.ListUsersRequest;
import com.to8to.thrift.diary.user.UpdateUserRequest;

public class SceneClientZK
{
    public static TTransport transport;
    public static TProtocol protocol;
    //    public static SceneDiaryService.Client client;
    public static SceneDiaryService.Iface client;

    //    public boolean open(String host, int port)
    //    {
    //        transport = new TSocket(host, port);
    //        transport = new TFramedTransport(transport);
    //        try
    //        {
    //            transport.open();
    //        }
    //        catch (TTransportException e)
    //        {
    //            return false;
    //        }
    //
    //        // protocol = new TBinaryProtocol(transport, true, true);
    //        protocol = new TBinaryProtocol(transport);
    //
    //        client = new SceneDiaryService.Client(protocol);
    //
    //        return true;
    //    }

    public boolean close()
    {
        transport.close();
        return true;
    }

    public void testAddScene() throws TException
    {
        TScene scene = new TScene();
        scene.comm_name = "哈哈";
        scene.setOwner_id("15");
        scene.setName_c("xx");
        scene.setPlatform(1);
        scene.setPublish_source(2);
        CreateSceneRequest req = new CreateSceneRequest();

        req.setScene(scene);
        System.out.println(client.CreateScene(req));
    }

    public void testAddDiary() throws TException
    {
        TDiary diary = new TDiary();
        diary.setScene_id("291680");
        diary.setOwner_id("1304433");
        diary.setProgress_id(3);
        diary.setTag_id(11);

        diary.setContent("第10篇日记");
        diary.setOwner_id("0");
        diary.setScene_id("10");
        diary.setPlatform(1);
        diary.setPublish_source(2);
        diary.setProgress_id(1);
        diary.setTag_id(8);
        diary.setOtime((int) (System.currentTimeMillis() / 86400000));
        diary.setProgress_id(2);

        CreateDiaryRequest req = new CreateDiaryRequest();
        req.setDiary(diary);

        System.out.println(client.CreateDiary(req));
    }

    public void testAddProduct() throws TException
    {
        CreateProductRequest req = new CreateProductRequest();

        TProduct product = new TProduct();
        product.setScene_id("15695");
        product.setName("2防盗门");
        product.setBrand("2特");
        product.setPlatform(1);
        product.setPublish_source(1);
        product.setCategory_1(1);
        product.setCategory_2(6);
        product.setBuy_from_1("1");
        product.setBuy_from_2("1000");
        product.setBuy_from_name("红太阳装饰城");
        product.setUnit_price(600);

        req.setProduct(product);
        System.out.println(client.CreateProduct(req));
    }

    public void testAddComment() throws TException
    {
        TComment comment = new TComment();
        comment.setScene_id("1");
        comment.setContent("今天也第二次评论");
        comment.setUser_id("1239");
        comment.setOwner_id("6930");
        //		comment.setDiary_id("21");
        //		comment.setRef_comment_id("30068");
        //		comment.setParent_comment_id("30335");
        //		comment.setRef_comment_id("30362");
        comment.setTgt_type(constConstants.TARGET_TYPE_PRODUCT);
        comment.setProduct_id("20");
        comment.setPlatform(2);
        comment.setPublish_source(2);

        CreateCommentRequest req = new CreateCommentRequest();
        req.setComment(comment);

        System.out.println(client.CreateComment(req));
    }

    public void testListScene() throws TException
    {
        ListScenesRequest req = new ListScenesRequest();
        req.setFields(Arrays.asList(ListScenesRequest._Fields._IDS.getFieldName()));
        req.set_ids(Arrays.asList("285209"));
        req.setLimit(10);
        System.out.println(client.ListScenes(req).getResults());
    }

    public void testListDiaries() throws TException
    {
        ListDiariesRequest req = new ListDiariesRequest();

        req.setFields(Arrays.asList(ListDiariesRequest._Fields._IDS.getFieldName(), "status"));
        req.set_ids(Arrays.asList("16702"));
        req.setStatus(Arrays.asList(1, 3));
        TSortField sort = new TSortField();
        sort.setField(TDiary._Fields.CTIME.getFieldName());
        sort.setAsc(-1);
        req.setSort(Arrays.asList(new TSortField[] { sort }));
        System.out.println(client.ListDiaries(req));
    }

    public void testListComments() throws TException
    {
        ListCommentsRequest req = new ListCommentsRequest();

        req.setFields(Arrays.asList("status", "tgt_type", "scene_id"));
        //        req.setScene_id(Arrays.asList("57039"));
        req.setStatus(Arrays.asList(1));
        req.setTgt_type(Arrays.asList(3));
        req.setScene_id(Arrays.asList("61579"));
        req.setSort(Arrays.asList(new TSortField("ctime", -1)));
        req.setOffset(0);
        req.setLimit(15);
        System.out.println(client.ListComments(req));
    }

    public void testUpdateProduct() throws TException
    {
        TProduct product = new TProduct();
        product.setUnit_price(12.5);

        UpdateProductRequest req = new UpdateProductRequest();
        req.setFields(Arrays.asList("unit_price"));
        req.setProduct(product);
        req.set_id("20");
        System.out.println(client.UpdateProduct(req));
    }

    public void testUpdateScene() throws TException
    {
        TScene scene = new TScene();

        UpdateSceneRequest req = new UpdateSceneRequest();

        req.setFields(Arrays.asList(new String[] {
            TScene._Fields.HOMETYPE.getFieldName(),
            TScene._Fields.STYLE.getFieldName(),
            TScene._Fields.CGATE.getFieldName(),
            TScene._Fields.HOUSE_TYPE.getFieldName() }));
        req.set_id("463096");
        scene.setHometype(14);
        scene.setStyle(Arrays.asList(1));
        scene.setCgate(1);
        scene.setHouse_type(0);
        req.setScene(scene);

        System.out.println(client.UpdateScene(req));
    }

    public void testUpdateDiaries() throws TException
    {
        TDiary diary = new TDiary();
        UpdateDiaryRequest req = new UpdateDiaryRequest();

        req.setFields(Arrays.asList(new String[] { TDiary._Fields.PROGRESS_ID.getFieldName(), TDiary._Fields.TAG_ID.getFieldName() }));
        req.set_id("16700");
        req.setDiary(diary);

        diary.setProgress_id(3);
        diary.setTag_id(503);

        req.is_user_do = false;
        System.out.println(client.UpdateDiary(req));
    }

    public void deleteComment() throws TException
    {
        DeleteCommentRequest req = new DeleteCommentRequest();
        req.set_ids(Arrays.asList("30038"));
        System.out.println(client.DeleteComment(req));
    }

    public void deleteProduct() throws TException
    {
        DeleteProductRequest req = new DeleteProductRequest();
        req.set_ids(Arrays.asList("210"));
        System.out.println(client.DeleteProduct(req));
    }

    public void deleteDiary() throws TException
    {
        DeleteDiaryRequest req = new DeleteDiaryRequest();
        req.setDiary_ids(Arrays.asList("4688", "4695"));
        System.out.println(client.DeleteDiary(req));
    }

    public void deleteScene() throws TException
    {
        DeleteSceneRequest req = new DeleteSceneRequest();
        req.set_ids(Arrays.asList("47048"));
        System.out.println(client.DeleteScene(req));
    }

    public void testListJingXuan() throws TException
    {
        ListJingXuanSceneRequest req = new ListJingXuanSceneRequest();
        ListSceneCondition cond = new ListSceneCondition();
        req.setOffset(0);
        req.setLimit(15);
        ListJingXuanSceneResponse resp = client.ListJingXuanScene(req);
        System.out.println(resp);
        System.out.println("total : " + resp.getTotal());
        System.out.println(resp.getResultsSize());
    }

    public void listNewest() throws TException
    {
        ListNewestSceneRequest req = new ListNewestSceneRequest();
        req.setOffset(0);
        req.setLimit(5);
        req.setTop_num(5);
        req.setPlatform(1);
        ListSceneCondition cond = new ListSceneCondition();
        cond.setFields(Arrays.asList(new String[] { "progress_ids", "ftime" }));
        cond.setProgress_ids(Arrays.asList(1, 5, 8));
        cond.setFtime(0);
        req.setCond(cond);
        ListNewestSceneResponse resp = client.ListNewestScene(req);
        System.out.println("total : " + resp.getTotal());
        System.out.println("trace_tag : " + resp.getTrace_tag());
        //        resp.getResults().stream().forEach(s -> {
        //            System.out.print("id : " + s.scene._id);
        //            System.out.print("  op_tag : " + s.scene.op_tags);
        //            System.out.print("  owner_type: " + s.scene.stat.owner_type);
        //            System.out.print("  recent_time : " + s.scene.stat.recent_time);
        //            System.out.println(" progress_id : " + s.scene.progress_id);
        //        });
    }

    public void testListSceneDetail() throws Exception
    {
        ListSceneDetailRequest req = new ListSceneDetailRequest();
        req.set_id("52425");
        req.setScene_reply_num(10);
        req.setDiary_reply_num(2);
        req.setProduct_num(10);
        req.setOffset(0);
        req.setLimit(10);
        req.setVersion(2.5d);
        req.setSort(Arrays.asList(new TSortField("progress_id", 1), new TSortField("otime", -1)));
        req.setStatus(Arrays.asList(1));

        ListSceneDetailResponse resp = client.ListSceneDetail(req);

        System.out.println(resp);
    }

    public void testBehave() throws Exception
    {
        TBehavior behavior1 = new TBehavior();
        behavior1.setUser_id("");
        behavior1.setBhv_type(1);
        behavior1.setTgt_type(1);
        behavior1.setTgt_id("359565");
        behavior1.setStatus(1);

        //		TBehavior behavior2 = new TBehavior();
        //		behavior2.setUser_id("123456");
        //		behavior2.setBhv_type(constConstants.BEHAVIOR_TYPE_LIKE);
        //		behavior2.setTgt_type(constConstants.TARGET_TYPE_DIARY); 
        //		behavior2.setTgt_id("31");
        //		behavior2.setStatus(1);

        BehaveRequest req = new BehaveRequest();
        req.setBehaviors(Arrays.asList(behavior1));
        System.out.println(client.Behave(req));
    }

    public void testListMessages() throws Exception
    {
        ListMessagesRequest req = new ListMessagesRequest();
        req.setFields(Arrays.asList("tgt_read", "tgt_del", "src_uid"));
        req.setSrc_uid("123458");
        req.setTgt_read(0);

        ListMessagesResponse resp = client.ListMessages(req);

        System.out.println(resp);
    }

    public void testListBehave() throws Exception
    {
        ListBehaviorRequest req = new ListBehaviorRequest();
        //		req.setFields(Arrays.asList("user_id", "tgt_id", "bhv_type", "tgt_type", "status"));
        req.setFields(Arrays.asList("bhv_type", "status"));
        req.setBhv_type(3);
        req.setStatus(1);
        System.out.println(client.ListBehavior(req));
    }

    public void testListRecommend() throws Exception
    {
        RecommendSceneRequest req = new RecommendSceneRequest();
        req.setStyle(Arrays.asList(5, 6, 8));
        req.setArea(0);
        req.setLimit(3);
        req.setExcludeIds(Arrays.asList("47048"));
        System.out.println(client.RecommendScene(req));
    }

    public void testUpdateMessages() throws Exception
    {
        UpdateMessageRequest req = new UpdateMessageRequest();
        req.setFields(Arrays.asList("tgt_del", "tgt_read"));
        req.setMessage(new TMessage().setTgt_del(1).setTgt_read(1));
        req.setIds(Arrays.asList("1", "2"));

        UpdateMessageResponse resp = client.UpdateMessage(req);

        System.out.println(resp);
    }

    public void testListTopUsers() throws Exception
    {
        ListUsersRequest req = new ListUsersRequest();
        req.setFields(Arrays.asList("user_id"));
        req.setUser_id("543978");
        req.setLimit(6);
        System.out.println(client.ListUsers(req));
        //		System.out.println(client.ListUsers(null));
    }

    public void testVerify() throws Exception
    {
        VerifyRequest req = new VerifyRequest();
        req.setEntity_id("910");
        req.setEntity_type(constConstants.TARGET_TYPE_PRODUCT);
        req.setStatus(1);
        //		req.setRemark("不行");
        System.out.println(client.verify(req));
    }

    public void testGetStConfigSubIdMap() throws Exception
    {
        GetStConfigSubIdMapRequest req = new GetStConfigSubIdMapRequest();
        //		req.setType_name(constConstants.CONF_HOUSE_TYPE);
        //		req.setLevel(1);
        //		System.out.println(client.GetStConfigSubIdMap(req));
        req.setType_name(constConstants.CONF_PROG_TYPE_2);
        req.setLevel(2);
        req.setParent_id("3");
        System.out.println(client.GetStConfigSubIdMap(req));
    }

    public void testGetStOrderList() throws Exception
    {
        GetStOrderListRequest req = new GetStOrderListRequest();
        req.setType_name(constConstants.CONF_PROG_TYPE_2);
        req.setParent_id(3);
        System.out.println(client.GetStOrderList(req));
    }

    public void testGetAllStConfigIdMap() throws TException
    {
        GetAllStConfigIdMapRequest req = new GetAllStConfigIdMapRequest();
        req.setVersion(2.5d);
        GetAllStConfigIdMapResponse res = client.GetAllStConfigIdMap(req);
        if (res.getRes().equals("succ"))
        {
            List<TStType> st_types = res.getSt_types();
            for (TStType st_type : st_types)
            {
                System.out.println(st_type.getLevel());
                System.out.println(st_type.getParent_type_id());
                System.out.println(st_type.getId_map());
            }
        }
    }

    public void testListAllCategoryStat() throws Exception
    {
        ListAllCategoryStatRequest req = new ListAllCategoryStatRequest();
        req.setShow_tag(0);
        req.setVersion(2.5d);
        //        req.setStatus(Arrays.asList(1, 3, 4));
        ListAllCategoryStatResponse resp = client.ListAllCategoryStat(req);
        System.out.println(resp);
    }

    public void testJudgeProductDiary() throws Exception
    {
        JudgeProductUsedRequest req = new JudgeProductUsedRequest();
        req.setProduct_ids(Arrays.asList("30", "31", "548"));
        System.out.println(client.JudgeProductUsed(req));
    }

    public void testUpdateUser() throws TException
    {
        UpdateUserRequest req = new UpdateUserRequest();
        req.setFields(Arrays.asList(TUserScore._Fields.PROGRESS_ID.getFieldName(), "progress_stime"));
        req.set_id("1457106");
        TUserScore user = new TUserScore();
        user.setProgress_id(3);
        user.setProgress_stime((int) (System.currentTimeMillis() / 1000));
        req.setUser(user);
        System.out.println(client.UpdateUser(req));
    }

    public void testListProgressImages() throws TException
    {
        ListProgressImagesRequest req = new ListProgressImagesRequest();
        req.setScene_id("48100");
        System.out.println(client.ListProgressImages(req));
    }

    public void testListProducts() throws TException
    {
        ListProductRequest req = new ListProductRequest();
        req.setFields(Arrays.asList(new String[] { ListProductRequest._Fields._IDS.getFieldName() }));
        req.set_ids(Arrays.asList(new String[] { "1343" }));
        System.out.println(client.ListProduct(req));
    }

    public void testListSceneDiaryViews() throws TException
    {
        ListSceneDiaryViewsRequest req = new ListSceneDiaryViewsRequest();
        ListSceneCondition condi = new ListSceneCondition();
        condi.setFields(Arrays.asList(new String[] {
            ListSceneCondition._Fields.OWNER_IDS.getFieldName(),
            ListSceneCondition._Fields.STATUS.getFieldName() }));
        condi.setOwner_ids(Arrays.asList(new String[] { "1000728" }));
        condi.setStatus(Arrays.asList(1, 2, 3, 4));
        req.setCond(condi);
        System.out.println(client.ListSceneDiaryViews(req));
    }

    public void testStatistic() throws TException
    {
        ListStatisticRequest req = new ListStatisticRequest();
        req.setTgt_type(constConstants.TARGET_TYPE_SCENE);
        req.setFrom_time(0);
        req.setTo_time(1450000000);
        System.out.println(client.ListStatistic(req));
    }

    public void testListCompanyAllScenes() throws TException
    {
        ListCompanyAllScenesRequest req = new ListCompanyAllScenesRequest();
        req.setCom_id(78691);
        System.out.println(client.ListCompanyAllScenes(req));
    }

    public void testDeleteComment() throws TException
    {
        DeleteCommentRequest req = new DeleteCommentRequest();
        req.set_ids(Arrays.asList("35084"));
        System.out.println(client.DeleteComment(req));
    }

    public static void testListCommunity() throws TException
    {
        ListCompaniesRequest req = new ListCompaniesRequest();
        req.setFields(Arrays.asList(new String[] {
            ListCompaniesRequest._Fields.COM_IDS.getFieldName(),
            ListCompaniesRequest._Fields.SCENE_STATUS.getFieldName(),
            ListCompaniesRequest._Fields.WITH_SCENE.getFieldName() }));

        req.setCom_ids(Arrays.asList(new Integer[] { 839468, 1481414 }));
        req.setWith_scene(1);
        req.setScene_limit(1);
        req.setScene_sort(Arrays.asList(new TSortField[] { new TSortField("stat.owner_counts.y", -1) }));
        req.setScene_status(Arrays.asList(new Integer[] { 1 }));
        req.setOwner_group("y");
        req.setMin_owner_count(5);

        System.out.println(client.ListCompanies(req));
    }

    public static void testListCompanyTopDiary() throws TException
    {
        ListCompanyTopDiaryRequest req = new ListCompanyTopDiaryRequest();
        req.setCom_ids(Arrays.asList(new Integer[] { 573608, 972757, 1346198 }));

        System.out.println(client.ListCompanyTopDiary(req));
    }

    public static void testListCompanies() throws TException
    {
        ListCompaniesRequest req = new ListCompaniesRequest();
        req.setFields(Arrays.asList(new String[] { "com_ids", "scene_sort", "with_scene", "no_shows" }));
        //        req.setCity_ids(Arrays.asList(new Integer[] { 1130 }));
        req.setCom_ids(Arrays.asList(new Integer[] {
            123,
            5388,
            5484,
            5486,
            5489,
            5491,
            5492,
            5493,
            5495,
            5497,
            5499,
            5500,
            5503,
            5504,
            5506,
            5507,
            5508,
            5509,
            5511,
            5513,
            5514,
            5515,
            5516,
            5517,
            5518,
            5520,
            5521,
            5528,
            5532,
            5533,
            5535,
            5536,
            5537,
            5538,
            5539,
            5540,
            5541,
            5542,
            5545,
            5546,
            5547,
            5548,
            5550,
            6101,
            6104,
            6108,
            6109,
            6110,
            6113,
            6114,
            6117,
            6119,
            6125,
            6127,
            6128,
            6129,
            6130,
            6131,
            6132,
            6133,
            6134,
            6136,
            6137,
            6139,
            6141,
            6142,
            6146,
            6148,
            6151,
            6161,
            6163,
            6167,
            6171,
            6175,
            6184,
            6195,
            6201,
            6216,
            6219,
            6226,
            6229,
            6231,
            6234,
            6263,
            6268,
            6304,
            6309,
            6388,
            6422,
            6423,
            6424,
            6427,
            6428,
            6431,
            6445,
            6468,
            6470,
            6472,
            6474,
            6475 }));
        //        req.setNo_shows(Arrays.asList(new String[] { ListCompaniesResponse._Fields.RESULTS.getFieldName() }));
        req.setWith_scene(1);
        req.setScene_limit(1);
        req.setSort(Arrays.asList(new TSortField("stat.recent_time", -1)));
        req.setLimit(5);
        System.out.println(client.ListCompanies(req));
    }

    public static void main(String[] args) throws TException
    {
        SceneClientZK c = new SceneClientZK();
        try
        {
            //            client = (Iface) ThriftClientFactory.getClient(SceneDiaryService.class, "0.0.0.0", 30012, 200000, null);

            MDC.put("tag", "adkmvweea");

            //                        client = (Iface) ThriftClientFactory.getClient(SceneDiaryService.class, "192.168.1.99", 30000, 200000, null);
            client = (Iface) ThriftClientFactory.getClient(SceneDiaryService.class, "192.168.3.90", 30006, 200000, null);

            //			c.open("192.168.3.233", 1111);
            //            ThriftClient thrift_client = new ThriftClient("com.to8to.thrift.diary.service.SceneDiaryService", "192.168.3.19", 30000, 200000);
            //            //            ThriftClient thrift_client = new ThriftClient("com.to8to.thrift.diary.service.SceneDiaryService", "192.168.3.194", 30000, 200000);
            //            client = (SceneDiaryService.Iface) thrift_client.getProxy(null);
            //            c.open("192.168.3.19", 30014);
            //            c.open("0.0.0.0", 30012);
            //			c.open("58.67.156.48", 30012);
            //            c.open("192.168.3.19", 30014);
            //			c.testAddScene();
            //            			c.testAddDiary();
            //            c.testAddProduct();
            //			c.deleteProduct();
            //			for (int i = 0; i < 1000; i++)
            //				c.testAddComment();
            //            c.testListScene();
            //            c.testListSceneByCommId();
            //            testListCommunity();
            //			c.testAddComment();
            //            c.testListScene();
            //                                              c.testListDiaries();
            c.testListComments();
            //            c.testUpdateScene();
            //            			c.testUpdateDiaries();
            //			c.deleteComment();
            //			c.deleteProduct();
            //			c.deleteDiary();
            //            c.deleteScene();
            //            c.testListJingXuan();
            //            c.listNewest();
            //            c.listNewest();

            //                        c.testListSceneDetail();
            //            c.testListProgressImages();
            //                        c.testBehave();
            //			c.testListMessages();
            //                        c.testListBehave();
            //                        c.testListProducts();
            //			c.testListRecommend();
            //			c.testUpdateMessages(); 
            //            c.testListTopUsers();
            //            c.testVerify();
            //            c.testListAllCategoryStat();
            //			c.testGetStConfigSubIdMap();
            //                        c.testGetAllStConfigIdMap();
            //			c.testGetStOrderList();
            //			c.testJudgeProductDiary();
            //            c.testUpdateUser();
            //			c.testUpdateProduct();
            //			c.testStatistic();
            //			c.testAddComment();
            //			c.testListCompanyAllScenes();
            //			c.testDeleteComment();
            //            			c.testListRecommend();
            //			c.testListJingXuan();
            //            c.testListSceneDiaryViews();
            //            c.testBGQueue();
            //                        testListCommunity();
            //            testListCompanyTopDiary();
            //            testListCompanies();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            //            c.close();
        }
    }
}
